package com.hulizuofang.wol.chat.client.ui.event.selectuser;

import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HasHandlers;
import com.hulizuofang.wol.chat.client.data.ChatUser;

public class SelectUserEvent extends GwtEvent<SelectUserHandler> {
	private static final Type<SelectUserHandler> TYPE = new Type<SelectUserHandler>();
	private final ChatUser chatUser;

	SelectUserEvent(ChatUser chatUser) {
		this.chatUser = chatUser;
	}
	
	public ChatUser getChatUser() {
		return chatUser;
	}

	public static void fire(final HasHandlers source, ChatUser chatUser) {
		source.fireEvent(new SelectUserEvent(chatUser));
	}

	public static Type<SelectUserHandler> getType() {
		return TYPE;
	}
	@Override
	public Type<SelectUserHandler> getAssociatedType() {
		return getType();
	}

	@Override
	protected void dispatch(SelectUserHandler handler) {
		handler.onSelectUser(this);
	}

}
